package com.groupbuying.cheetah.currencyCustomer.controller;

import com.groupbuying.cheetah.common.PageUtils;
import com.groupbuying.cheetah.currencyCustomer.service.CustomerCurrencyService;
import com.groupbuying.cheetah.utils.apiresult.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 积分详情
 */
@RestController
@RequestMapping("/currency")
public class CustomerCurrencyController {

    @Autowired
    private CustomerCurrencyService customerCurrencyService;
    //查询列表详情
    @GetMapping("/getCurrencyDetails")
    public PageUtils getCurrencyDetails(@RequestBody Map<String,Object> map){
        return customerCurrencyService.getCurrencyDetails(map);
    }
    //查询积分
    @GetMapping("/getAllCurrency")
    public  Map getAllCurrency(@RequestBody Map<String,String> map){
        return customerCurrencyService.getAllCurrency(map);
    }
    //查询积分详情
    @GetMapping("/getCurrencyLogByCustomerId")
    public PageUtils getCurrencyLogByCustomerId(@RequestBody Map<String,Object> map){
        return customerCurrencyService.getCurrencyLogByCustomerId(map);
    }
    //按月份统计积分
    @GetMapping("/getMouthCurrency")
    public ApiResult getMouthCurrency(@RequestBody Map<String,String> map){
        List<Map<String, Object>> mouthCurrency = customerCurrencyService.getMouthCurrency(map);
        return  ApiResult.success(mouthCurrency);
       /* Map<String,Object> param = new HashMap<>();
        param.put("mouthCurrency",mouthCurrency);
        return param;*/
    }
    @GetMapping("/getCurrenManage")
    public  PageUtils getCurrenManage(@RequestBody Map<String,Object> map){
        return customerCurrencyService.getCurrenManage(map);
    }
    @GetMapping("/sumCurrency")
    public  Map<String,Object> sumCurrency(@RequestBody Map<String,Object> map){
        return customerCurrencyService.sumCurrency(map);
    }
}
